class Group < ActiveRecord::Base
  
  include DynamicDefaultScoping
  
  validates :enterprise_id, :presence => true
  
  has_and_belongs_to_many :users, :uniq => true
  belongs_to :enterprise
  
  default_scope :current_enterprise,lambda { 
    where(
      :enterprise_id => Enterprise.current_id 
    )
  }
end
